import NotFound from "@/Views/404";
import Forbidden from "@/Views/403";

export default [
  // 用户路由
  {
    path: "/user",
    hideInMenu: true, // 设置标志位，递归路由时过滤掉
    // component: { render: (h) => h("router-view") },
    component: () => import("@/layout/UserLayout"),
    children: [
      {
        path: "/user",
        redirect: "/user/login",
      },
      {
        path: "/user/login",
        name: "login",
        component: () => import("@/Views/User/Login"),
      },
      {
        path: "/user/register",
        name: "register",
        component: () => import("@/Views/User/Register"),
      },
    ],
  },

  {
    path: "/",
    meta: { authority: ["user", "admin"] }, // 主页管理员用户都可以进
    component: () => import("@/layout/BasicLayout"),
    children: [
      // dashboard仪表板
      {
        path: "/",
        redirect: "/dashboard/analysis",
      },
      {
        path: "/dashboard",
        name: "dashboard",
        meta: { icon: "dashboard", title: "仪表盘" }, //希望添加一些图标，中文等信息
        component: { render: (h) => h("router-view") },
        children: [
          // 分析页
          {
            path: "/dashboard/analysis",
            name: "analysis",
            meta: { title: "分析页" }, // 只在一级菜单显示图标
            component: () => import("@/Views/Dashboard/Analysis"),
          },
        ],
      },

      // form表单
      {
        path: "/form",
        name: "form",
        meta: { icon: "form", title: "表单", authority: ["admin"] }, // form表单点击只有admin才能进
        component: { render: (h) => h("router-view") },
        children: [
          // 基础表单
          {
            path: "/form/basic-form",
            name: "basicform",
            meta: { title: "基础表单" },
            component: () => import("@/Views/Forms/BasicForm"),
          },
          // 分步表单
          {
            path: "/form/step-form",
            name: "stepform",
            hideChildrenInMenu: true, // 第一步第二步也不希望渲染，所以也设置标志位
            meta: { title: "分布表单" },
            component: () => import("@/Views/Forms/StepForm"),
            children: [
              // 信息页
              {
                path: "/form/step-form/info",
                name: "info",
                component: () => import("@/Views/Forms/StepForm/Step1"),
              },
              // 确认页
              {
                path: "/form/step-form/confirm",
                name: "confirm",
                component: () => import("@/Views/Forms/StepForm/Step2"),
              },
              // 结果页
              {
                path: "/form/step-form/result",
                name: "result",
                component: () => import("@/Views/Forms/StepForm/Step3"),
              },
            ],
          },
        ],
      },
    ],
  },
  {
    path: "/403",
    name: "403",
    hideInMenu: true,
    component: Forbidden,
  },
  {
    path: "*",
    name: "404",
    hideInMenu: true,
    component: NotFound,
  },
];
